package Test11.topic;

/*本类用于练习面向对象封装---继承（构造）*/
public class Extends {
    public static void main(String[] args) {
        Dog d =new Dog();
        Pig p = new Pig();

    }
}
class Animal{
    int a = 100;
    private String name = "edgyfuigd";

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    {
        System.out.println("构造代码块");
    }
    public Animal(){
        System.out.println(a);
        System.out.println(name);
    }
    public Animal(String b){
        System.out.println(b);
    }
}
class Dog extends Animal{
    int a = 10;

    public Dog(){
        super();

        System.out.println("我是父类"+a);
    }
}
class Pig extends Dog{
    public Pig(){
        super();
        System.out.println(a);
        {
            System.out.println("局部代码块");
        }
    }
}